
pub mod simp_wheel;

pub(crate)  const MAXIMUM_CAPACITY: u64 = 1 << 30;

/// 定义Wheel的基本属性
pub trait Wheel {

    /// 创建新的Wheel
    fn new(tick_duration_ms: u32, tick_solt: u64) -> Self;

    /// 开始，返回开始的时间
    fn start<T>(&mut self, task: T) -> i64 where T : Fn(i64) -> () + Send + 'static;

    /// 停止wheel
    fn stop(&mut self);

    /// 获取Wheel的开始时间
    fn start_time_ms(&self) -> Option<i64>;

    /// Wheel一秒的间隔
    fn tick_duration_ms(&self) -> u32;

    fn tick_slot(&self) -> u64;
}

#[cfg(test)]
mod tests {
    use chrono::prelude::*;

    #[test]
    fn test_chrono() {
        let local = Local::now();
        println!("{:?}---{}", local, local.timestamp_millis());
        
        let utc: DateTime<Utc> = Utc::now();
        println!("{:?}", utc);

        // 中国的时区
        let fixed_ed = utc.with_timezone( &FixedOffset::east(8 * 3600));
        println!("{:?}", fixed_ed);
       
    }
}